home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Util / B / Bind Icons.cpt / Bind.Icons.Manual < prev   
Text File  |  1987-05-12  |  10KB  |  183 lines

  1.                           ICON BINDING UTILITY
  2.                                         -- John Jeppson
  3.  
  4.  
  5.    This program is the EASIEST way to bind a new icon to an application.  
  6. The program will actually make the Finder display a new icon for your 
  7. completed application.  What's more it will really work..  provided you 
  8. take one simple precaution to avoid sabotaging yourself.  It should work, 
  9. in fact, for any application: MacForth turnkeys, stand-alone "C" 
  10. applications, assembled applications you have written yourself, or 
  11. applications you have bought, begged, or whatever.  
  12.  
  13.    The program will do more than that.  It will also create or re-create 
  14. all those nasty BNDL's and FREF's that your application is supposed to 
  15. have.  It will operate on the "Desk Top" file to excise its old habits.  
  16. And finally it will merge a bag of resources, if you have any, that your 
  17. new application will require.  
  18.  
  19.  
  20. The Contest: Man vs. Machine.
  21.  
  22.    Let's face it.  This is mortal combat, you against Finder, your ulcers 
  23. against his monumental stubbornness.  All you want is a little recognition 
  24. for your hard work, your own icon proudly displayed on the desktop.  All 
  25. Finder wants is to get away with as little work as possible.  
  26.  
  27.    So maybe you thought you would try the "death thrust", stabbing Finder 
  28. in the back by deleting "Desk Top" from the disk.  But if you don't 
  29. understand the game then Finder may rise up from the ashes with the same 
  30. old icon, and laugh you right into your grave.  
  31.  
  32.  
  33. How To Make It Go:
  34.  
  35. 1.  The program begins by asking you to locate the target application with 
  36. the standard file dialog.  The target can be in any folder on any volume.  
  37.  
  38. 2.  Next you see the main dialog in which you enter the following 
  39. information: 
  40.  
  41.  
  42.     APPLICATION SIGNATURE: This is a FileType, 4 bytes of ascii text.  
  43. Should be all uppercase printing characters, and should not conflict with 
  44. standard filetypes such as TEXT, DATA, etc.  Don't confuse this with the 
  45. application's filetype which is always APPL.  The signature is a different 
  46. filetype.  If your application makes or uses "daughter" files then those 
  47. files will refer to their parent's signature as the "creator".  It's the 
  48. same thing.  Application signature = creator = a filetype.  You need one 
  49. whether your application makes daughter files or not.  You should try to 
  50. make it unique.  
  51.  
  52.    "Phooey!", you say, "I've got this application, and I want to stick a 
  53. new icon on it, and I couldn't care less what signature the damn thing 
  54. has".  This is a mistake.  The "glue" that sticks a particular icon to your 
  55. application is a resource called a BNDL ("bundle"), and various BNDL's are 
  56. distinguished from each other by their signatures-- sort of like names.  If 
  57. you want a different icon to be displayed then you will be changing the 
  58. contents of the BNDL, but Finder simply cannot cope with two "different" 
  59. BNDL's which have the same signature.  He simply won't try, and you'll be 
  60. up the creek.  If you want a new icon, then use a new signature.  This 
  61. problem is discussed at greater length below.  
  62.  
  63.     It's easy to make a new signature; just type four capital letters in 
  64. the little box.  
  65.  
  66.    ICN#ID: This is the resource number of your new icon.  We aren't going 
  67. to draw the icon for you, you'll have to do that yourself, probably with 
  68. Resource Editor.  You should already have done this, and assigned the icon 
  69. (ICN# really, a pair of icons) an ID number between 128 and 32767 
  70. inclusive.  It doesn't much matter which, as long as the number is unique 
  71. (among ICN# ID's) within your own application.  You should store the 
  72. completed ICN# resource in your application, or in a special bag file we 
  73. will tell you about in a moment (NOT MacForth's "Resource Bag", if you are 
  74. making a MacForth turnkey).  
  75.  
  76.    VERSION STRING: This is strictly optional; you can leave it blank.  
  77. Traditionally this is an ascii string containing the version number or 
  78. date.  For example: "RingLocator version 1.02, copyright 1986, Frodo".  
  79.  
  80.    (other) FILETYPEs: These, if any, are the FileTypes and associated ICN# 
  81. ID numbers of daughter filetypes which your application may create.  For 
  82. example, MacForth may create BLKS files and these will be displayed with 
  83. their own icon.  Similarly, MacWrite creates WORD files which also have a 
  84. distinctive icon.  These ICN# resources, if any, should be prepared and 
  85. stored along with the parent application's ICN# resource, wherever you put 
  86. that.  
  87.  
  88. 3. When you have done all this click "OK"; the program will do the rest. 
  89. It will: 
  90.     (a) Merge your resources (deleting old versions) - see below; 
  91.     (b) Remove target's old signature, BNDL and FREF's, if any; 
  92.     (c) Build new signature, BNDL, and FREF's as necessary;
  93.     (d) Weed out the Desk Top of old bad stuff. 
  94.  
  95. Illuminating progress messages will appear.  Finally you will be directed 
  96. to return to the Finder to view your new icon.  
  97.  
  98.    In addition to operating on your application, the program also saves 
  99. your dialog entries in a disk file.  If you are unhappy with the final 
  100. result you can modify your application or turnkey and run "Bind.Icons" 
  101. again.  This time the dialog will come up with your old entries in place, 
  102. so you will probably just need to click "OK".  
  103.  
  104.    The "Revert" button returns the dialog entries to the configuration last 
  105. stored (by pressing "OK") or to blanks if this is the first time around.  
  106.  
  107. 4.  The data file which saves the dialog info has a special name.  It is 
  108. the same as your target application's name with the suffix ".bag".  For 
  109. example, if your application's name is "SuperScooper" then the data file 
  110. will be named "SuperScooper.bag".  For long-winded programmers there is a 
  111. length limit.  Your application's name will be trucated to 27 letters 
  112. before adding the suffix.  The "save" file is always placed in the target 
  113. application's folder.  
  114.  
  115. 5.  You guessed it! The place to put your resources is in the resource fork 
  116. of the datafile.  The dialog info is saved in the data fork.  ALL resources 
  117. found in the resource fork, if any, will be merged into your target 
  118. application, replacing any previous versions of the same Type and ID.  
  119. Optionally, you can make this file ahead of time, perhaps from Resource 
  120. Editor, and use it to store all your resources.  Bind.Icons program will 
  121. find and use the file, provided it has the proper ("--.bag") name and is 
  122. located in the same folder as the target application.  
  123.  
  124. 6.  WARNING: If you install a new signature and ICN#, then copy the file, 
  125. and then change one copy to a different ICN# with the SAME signature ..you 
  126. lose the game! Put the reserve copy on a different volume before re-running 
  127. Bind.Icons with a different ICN# (but the same signature).  Remember, your 
  128. hard disk is probably all one volume.  This is further explained in the 
  129. following: 
  130.  
  131.  
  132. Why It Works.
  133.  
  134.    Finder has this simple rule: he saves one and only one copy of each 
  135. different bundle he encounters.  What is a bundle? It's a statement linking 
  136. a particular signature with a particular ICN#.  What is a "different" 
  137. bundle? It's a bundle with a different signature.  
  138.  
  139.    So Finder pokes along looking at files.  He sees an application with a 
  140. previously unknown signature.  Grumbling, he stores a copy of that bundle 
  141. in Desk Top, an invisible file in the root directory.  This COPY of the 
  142. bundle (stored in Desk Top) is what reminds Finder to display the 
  143. application with that signature using such-and-such icon.  
  144.  
  145.    Pretty soon he finds another application with the same signature.  Now 
  146. Finder is not about to go to the trouble of checking whether this 
  147. application wants a different icon.  He already has a bundle with that 
  148. signature, and that's it! No more.  "You want a different icon, buddy? You 
  149. get yourself a different signature".  
  150.  
  151.    So if you want Finder to use a different ICN# you have to change BOTH 
  152. signature and ICN# SIMULTANEOUSLY.  Doesn't work if you change the 
  153. signature and then return to the Finder before changing the ICN# resource 
  154. (for example with Resource Editor).  It doesn't matter how skillfully you 
  155. swap ICN# resources.  Once Finder has had a look at your application with 
  156. the new signature he will never think about it again.  He already "knows" 
  157. which icon to use...  the old one which was there during that brief passage 
  158. through the Finder on the way to Resource Editor.  
  159.  
  160.    So suppose you destroy the Desk Top file.  This often works.  But not if 
  161. you have left a copy of your application with the new signature, but an old 
  162. ICN#, ANYWHERE on your application's volume.  (That may mean anywhere on 
  163. your hard disk, in any folder.) When Finder rebuilds the Desk Top he will 
  164. save the first bundle he finds with that signature, and that's all.  
  165. Probably it will be the other one, not the one you want.  
  166.  
  167.    You can have as many copies of (old signature - old icon) as you want.  
  168. You can have as many copies of (new signature - new icon) as you want.  
  169.          *** NEVER LET THE FINDER SEE SOMETHING IN-BETWEEN ***  
  170.  
  171.  
  172. Technical Details:
  173.  
  174.    Bind.Icons does a bit of surgery on the Desk Top file, the one that is 
  175. located in the root directory of the volume which contains the target 
  176. application.  It simply removes all BNDL's (and associated FREF's) which 
  177. have the new signature, if any were present.  In effect it has wiped part 
  178. of Desk Top leaving the rest.  Next time around, Finder will not recognize 
  179. this signature.  He will save the application's bundle (signature-ICN# 
  180. combo) in the Desk Top and will use it to display the application on the 
  181. screen.  There had better be only one such (signature-ICN# combo) around 
  182. for him to find! 
  183.